public class Test {
    public static void main(String[] args) {
        StringBuilder stringBuilder=new StringBuilder("haha ");
        System.out.println(stringBuilder.append("man"));
        StringBuffer stringBuffer=new StringBuffer("what can I say");
        stringBuffer.append("?");
        System.out.println(stringBuffer);
    }
    public static void main7(String[] args) {
        String s = "hello";
        s += " world";
        System.out.println(s); // 输出：hello world
    }
    public static void main6(String[] args) {
        String str="    what can I say      ";
        String s=str.trim();
        System.out.println(s);
    }
    public static void main5(String[] args) {
        String str = "helloworld" ;
        System.out.println(str.substring(5));
        System.out.println(str.substring(0, 5));//左开右闭
    }
    public static void main4(String[] args) {
        String s1="hhh";
        String s2="hhh";
        System.out.println(s1==s2);
    }
    public static void main3(String[] args) {
        String str="haha\\man\\what\\can\\I\\say?";
        for(String tmp:str.split("\\\\")){
            System.out.println(tmp);
        }
    }
    public static void main2(String[] args) {
        String IP="192&man.168.1.1&haha";
        for(String tmp:IP.split(" ")){
            System.out.println(tmp);
        }
    }
    public static void main1(String[] args) {
        String IP="192&man.168.1.1&haha";
        String s[]=IP.split("\\.");  //在 " . " 前加\\
        for(String tmp:s){
            for(String tmp2:tmp.split("&")){
                System.out.println(tmp2);
            }
        }
    }
}
